#include <bits/stdc++.h>
#include "testlib.h"
using namespace std;
#define int long long
const int N = 51; 
signed main(signed argc,char* argv[])
{
    registerTestlibCmd(argc, argv);
    auto s=inf.readString(), t=inf.readString();
    auto out=ouf.readString(), Ans=ans.readString();
    if(out!=Ans)	quitf(_wa, "WRONG ANSWER.\nON 1ST LINE.");
    if(out=="YES") {
    	int n=s.size(), m=t.size();
    	s=' '+s, t=' '+t;
    	auto same=[&](int l,int r) {
    		for(int i=l+1;i<=r;++i)
    			if(s[i]!=s[i-1])	return 0;
    		return 1;
		};
    	vector<int> p={0};
    	for(int i=1;i<=m;++i)	p.emplace_back(ouf.readLong());
    	p.emplace_back(n+1);
    	for(int i=1;i<=m;++i)
    		if(!same(p[i-1]+1, p[i]-1))	quitf(_wa, "WRONG ANSWER.\nON 2ND LINE\nINVAILD CONSTRUCTION.");
    	quitf(_ok, "ALL CORRECT.\nTHE ANSWER IS YES.");
	}
	else	quitf(_ok, "ALL CORRECT.\nTHE ANSWER IS NO.");
	return 0;
}
